<template>
  <div class="PAdministrationList">
    <el-form label-width="100px" :model="activities">
      <el-form-item label="项目名称">
        <el-input v-model="activities.pname" clearable placeholder="请填写项目名称"></el-input>
      </el-form-item>
      <el-form-item label="展示路径">
        <el-input v-model="activities.purl" clearable placeholder="请填写展示路径"></el-input>
      </el-form-item>
      <el-form-item label="前端git地址">
        <el-input v-model="activities.pgitee" clearable placeholder="请填写gitee地址"></el-input>
      </el-form-item>
      <el-form-item label="后端git地址">
        <el-input v-model="activities.pgitee2" clearable placeholder="请填写gitee-2地址"></el-input>
      </el-form-item>
      <el-form-item label="标签">
        <el-input v-model="activities.plabel" clearable placeholder="请填写标签"></el-input>
      </el-form-item>
      <el-form-item label="简介">
        <el-input v-model="activities.ptext" clearable placeholder="请填写简介"></el-input>
      </el-form-item>
      <el-form-item label="备注">
        <el-input
          type="textarea"
          :autosize="{ minRows: 1, maxRows: 15}"
          v-model="activities.premarks"
          clearable
          placeholder="请填写备注"
          ></el-input>
      </el-form-item>
      <el-button type="success" plain size="mini" @click="addData()">确认添加</el-button>
      <el-button type="warning" plain size="mini" @click="resetData()">重置</el-button>
    </el-form>
  </div>
</template>

<script>
import ProjectInformation from "@/model/ProjectInformation";

export default {
  name: "PAdministrationList",
  components: {},
  data() {
    return {
      activities: {
        // pname: '',
        // purl: '',
        // pgitee: '',
        // plabel: '',
        // premarks: ''
      },
    };
  },
  async mounted() {
    // const res = await ProjectInformation.getId(1);
    // this.activities = res.data;
  },
  methods: {
    async addData(){
        //   this.$message({
        //   showClose: true,
        //   message: res
        // });
      this.$confirm('此操作将新增该记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let res = ProjectInformation.addData({
            data:this.activities
          });
          this.$message({
            type: 'success',
            message: '新增成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消新增'
          });
        });
    },
    resetData(){
      this.activities = {};
    }
  },
};
</script>

